package com.zwz.voObject;

import lombok.Data;
import java.util.List;
import java.util.Map;

@Data
public class QueryResultVO {
    private Integer code;
    private String message;
    private QueryData data;

    @Data
    public static class QueryData {
        private List<Map<String, Object>> records;
        private Long total;
        private Integer pageNum;
        private Integer pageSize;
    }

    public static QueryResultVO success(List<Map<String, Object>> records, Long total, Integer pageNum, Integer pageSize) {
        QueryResultVO vo = new QueryResultVO();
        vo.setCode(200);
        vo.setMessage("success");
        
        QueryData data = new QueryData();
        data.setRecords(records);
        data.setTotal(total);
        data.setPageNum(pageNum);
        data.setPageSize(pageSize);
        vo.setData(data);
        
        return vo;
    }

    public static QueryResultVO error(String message) {
        QueryResultVO vo = new QueryResultVO();
        vo.setCode(500);
        vo.setMessage(message);
        return vo;
    }
} 